home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / msjv6-5.zip / WINDOS.ZIP / WINIO.H < prev    next >
C/C++ Source or Header  |  1991-09-01  |  3KB  |  93 lines

  1. /*
  2. WINIO.H
  3. Stdio (e.g. printf) functionality for Windows - definition
  4. Dave Maxey - 1991
  5. */
  6.  
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /* ==== STDIO.H for Windows ==== */
  11. #include <stdarg.h>
  12. #ifdef __BORLANDC__
  13. /* Borland C++ STDIO.H doesn't do gets, etc. #if defined(_Windows) */
  14. #undef _Windows
  15. #include <stdio.h>
  16. #define _Windows
  17. #else
  18. #include <stdio.h>
  19. #endif
  20.  
  21. #undef putchar
  22. #define putchar fputchar
  23. #undef getchar
  24. #define getchar fgetchar
  25.  
  26. /* these were missing from original MSJ version, which assumes inclusion
  27.    of WINDOWS.H as well as WINIO.H.  #ifndef PASCAL is a semi-unreliable
  28.    way to check for inclusion of any vendor's WINDOWS.H */
  29. #ifndef PASCAL
  30. typedef unsigned HANDLE;
  31. typedef unsigned char BYTE;
  32. typedef unsigned WORD;
  33. typedef unsigned BOOL;
  34. typedef unsigned long DWORD;
  35. typedef unsigned HWND;
  36. typedef long LONG;
  37. #define PASCAL pascal
  38. #define FAR far
  39. #endif
  40.  
  41. /* ==== Extensions ==== */
  42.  
  43. /* winio_init() must be called before any of the above listed
  44. functions to init the i/o window. Similar arguments to WinMain(), but
  45. we drop the cmdline pointer but add a bufsize parameter (unsigned) -
  46. 0 means default (8k). */
  47. int winio_init(HANDLE, HANDLE, int, unsigned);
  48.  
  49. /* Makes the window inactive, and allows the user to view and play with
  50. it until double- clicking on the system menu to close it. NEVER RETURNS. */
  51. void winio_end(void);
  52.  
  53. /* closes the window immediately and frees up buffers */
  54. void winio_close(void);
  55.  
  56. /* to override default title of "Console I/O" */
  57. void winio_settitle(BYTE *);
  58.  
  59. /* May be SYSTEM_FIXED_FONT (default), ANSI_FIXED_FONT, or OEM_FIXED_FONT */
  60. BOOL winio_setfont(WORD);
  61.  
  62. /* To turn automatic updating of window off and on */
  63. BOOL winio_setpaint(BOOL);
  64.  
  65. /* To change the behavior of getchar() */
  66. BOOL winio_setecho(BOOL);
  67.  
  68. /* clear out the contents of the buffer and start over fresh */
  69. void winio_clear(void);
  70.  
  71. /* should be used to release cpu in spells between I/O calls. A
  72. WM_QUIT message received by it will exit the application. If that is
  73. a problem, use the winio_onclose function below */
  74. void winio_yield(void);
  75.  
  76. /* Returns the underlying Windows window handle to WINIO window */
  77. HWND winio_hwnd(void);
  78.  
  79. /* ==== User definable exit routine ==== */
  80.  
  81. typedef void (* DESTROY_FUNC)(void);
  82.  
  83. /* Optional notification function; without it, there is no way for your
  84. application to know if the user has double-clicked the system menu box */
  85. void winio_onclose(DESTROY_FUNC);
  86.  
  87. /* ==== Utility function built on message box ==== */
  88.  
  89. BOOL winio_warn(BOOL, const BYTE *, ...);
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93.